diff --git a/board/netstar/eeprom.c b/board/netstar/eeprom.c
index 5806128..1366457 100644
--- a/board/netstar/eeprom.c
+++ b/board/netstar/eeprom.c
@@ -27,43 +27,42 @@
 #include <common.h>
 #include <exports.h>
 #include <timestamp.h>
+#include <net.h>
 #include "../drivers/net/smc91111.h"
 
-#define SMC_BASE_ADDRESS CONFIG_SMC91111_BASE
-
-static u16 read_eeprom_reg(u16 reg)
+static u16 read_eeprom_reg(struct eth_device *dev, u16 reg)
 {
 	int timeout;
 
-	SMC_SELECT_BANK(2);
-	SMC_outw(reg, PTR_REG);
+	SMC_SELECT_BANK(dev, 2);
+	SMC_outw(dev, reg, PTR_REG);
 
-	SMC_SELECT_BANK(1);
-	SMC_outw(SMC_inw (CTL_REG) | CTL_EEPROM_SELECT | CTL_RELOAD,
+	SMC_SELECT_BANK(dev, 1);
+	SMC_outw(dev, SMC_inw (dev, CTL_REG) | CTL_EEPROM_SELECT | CTL_RELOAD,
 		 CTL_REG);
 	timeout = 100;
-	while((SMC_inw (CTL_REG) & CTL_RELOAD) && --timeout)
+	while((SMC_inw (dev, CTL_REG) & CTL_RELOAD) && --timeout)
 		udelay(100);
 	if (timeout == 0) {
 		printf("Timeout Reading EEPROM register %02x\n", reg);
 		return 0;
 	}
 
-	return SMC_inw (GP_REG);
+	return SMC_inw (dev, GP_REG);
 }
 
-static int write_eeprom_reg(u16 value, u16 reg)
+static int write_eeprom_reg(struct eth_device *dev, u16 value, u16 reg)
 {
 	int timeout;
 
-	SMC_SELECT_BANK(2);
-	SMC_outw(reg, PTR_REG);
+	SMC_SELECT_BANK(dev, 2);
+	SMC_outw(dev, reg, PTR_REG);
 
-	SMC_SELECT_BANK(1);
-	SMC_outw(value, GP_REG);
-	SMC_outw(SMC_inw (CTL_REG) | CTL_EEPROM_SELECT | CTL_STORE, CTL_REG);
+	SMC_SELECT_BANK(dev, 1);
+	SMC_outw(dev, value, GP_REG);
+	SMC_outw(dev, SMC_inw (dev, CTL_REG) | CTL_EEPROM_SELECT | CTL_STORE, CTL_REG);
 	timeout = 100;
-	while ((SMC_inw(CTL_REG) & CTL_STORE) && --timeout)
+	while ((SMC_inw(dev, CTL_REG) & CTL_STORE) && --timeout)
 		udelay (100);
 	if (timeout == 0) {
 		printf("Timeout Writing EEPROM register %02x\n", reg);
@@ -73,17 +72,17 @@
 	return 1;
 }
 
-static int write_data(u16 *buf, int len)
+static int write_data(struct eth_device *dev, u16 *buf, int len)
 {
 	u16 reg = 0x23;
 
 	while (len--)
-		write_eeprom_reg(*buf++, reg++);
+		write_eeprom_reg(dev, *buf++, reg++);
 
 	return 0;
 }
 
-static int verify_macaddr(char *s)
+static int verify_macaddr(struct eth_device *dev, char *s)
 {
 	u16 reg;
 	int i, err = 0;
@@ -91,7 +90,7 @@
 	printf("MAC Address: ");
 	err = i = 0;
 	for (i = 0; i < 3; i++) {
-		reg = read_eeprom_reg(0x20 + i);
+		reg = read_eeprom_reg(dev, 0x20 + i);
 		printf("%02x:%02x%c", reg & 0xff, reg >> 8, i != 2 ? ':' : '\n');
 		if (s)
 			err |= reg != ((u16 *)s)[i];
@@ -100,7 +99,7 @@
 	return err ? 0 : 1;
 }
 
-static int set_mac(char *s)
+static int set_mac(struct eth_device *dev, char *s)
 {
 	int i;
 	char *e, eaddr[6];
@@ -112,7 +111,7 @@
 	}
 
 	for (i = 0; i < 3; i++)
-		write_eeprom_reg(*(((u16 *)eaddr) + i), 0x20 + i);
+		write_eeprom_reg(dev, *(((u16 *)eaddr) + i), 0x20 + i);
 
 	return 0;
 }
@@ -150,6 +149,10 @@
 	int i, len, ret;
 	unsigned char buf[58], *p;
 
+	struct eth_device dev = {
+		.iobase = CONFIG_SMC91111_BASE
+	};
+
 	app_startup(argv);
 	if (get_version() != XF_VERSION) {
 		printf("Wrong XF_VERSION.\n");
@@ -160,14 +163,14 @@
 
 	return crcek();
 
-	if ((SMC_inw (BANK_SELECT) & 0xFF00) != 0x3300) {
+	if ((SMC_inw (&dev, BANK_SELECT) & 0xFF00) != 0x3300) {
 		printf("SMSC91111 not found.\n");
 		return 2;
 	}
 
 	/* Called without parameters - print MAC address */
 	if (argc < 2) {
-		verify_macaddr(NULL);
+		verify_macaddr(&dev, NULL);
 		return 0;
 	}
 
@@ -201,8 +204,8 @@
 	}
 
 	/* First argument (MAC) is mandatory */
-	set_mac(argv[1]);
-	if (verify_macaddr(argv[1])) {
+	set_mac(&dev, argv[1]);
+	if (verify_macaddr(&dev, argv[1])) {
 		printf("*** MAC address does not match! ***\n");
 		return 4;
 	}
@@ -210,7 +213,7 @@
 	while (len--)
 		*p++ = 0;
 
-	write_data((u16 *)buf, sizeof(buf) >> 1);
+	write_data(&dev, (u16 *)buf, sizeof(buf) >> 1);
 
 	return 0;
 }
